/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package business.service;

import com.star.common.CateData;
import com.start.model.CateModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.thrift.TException;

/**
 *
 * @author ngotandieu
 */
public class TTimsaoServiceImp implements TTimSaoService.Iface{

    @Override
    public List<Map<String, String>> getAllCategory() throws TException {
        CateModel cateModel = CateModel.getInstance();
        
        List<Map<String, String>> result = new ArrayList<>();
        List<CateData> cates = cateModel.getCate(-1, -1);
        for (CateData cate : cates) {
            Map<String, String> mapCate = new HashMap<>();
            mapCate.put("id", cate.getId());
            mapCate.put("name", cate.getName());
            
            result.add(mapCate);
        }
        return result;
    }
    
}
